<template>
   <div class="newsinfo-container">
     <h3 class="title">{{ newsinfo.title }}</h3> 
    <p class="subtitle"> 
        <span>发表时间:{{newsinfo.add_time | dateFormat}}</span>
        <span>点击:{{newsinfo.click}}次</span> 
    </p>
       <!-- <h3>新闻详情==={{ id}}</h3> -->
       <hr>
       <div class="content"  v-html="newsinfo.content"></div>
       <coments  :id="this.id"></coments>
  </div>
</template>

<script>
import  coments from  '@/components/setcontents/coments'
import   Vue   from 'vue'
import { Toast } from 'mint-ui'
Vue.http.options.root = 'http://www.liulongbin.top:3005/api/';
export default {
  name: 'newsitems',
  data(){
      return{
        id:this.$route.params.id , //这是url地址中传递过来的id值
        newsinfo:{},
      }
  },
  created(){
     this. getNewsInfo()
  },
  methods: {
       getNewsInfo(){  //获取新闻详情
         this.$http.get('getnew/' +this.id).then(result =>{
             if(result.body.status === 0){
              //  console.log(result.body)
                //  Toast("获取新闻成功")
                 this.newsinfo =result.body.message[0]
             }else{
                 Toast("获取新闻失败")
             }
         })
       }
  },
 components:{
       coments
 }
}
</script>
<style lang="scss" scoped>
.newsinfo-container{
  padding:0  4px;
         .title{
           font-size:16px;
           text-align: center;
      margin: 15px 0;
      color: red;
         }
       .subtitle{
               font-size:14px;
             color:#226aff; 
             display: flex;
             justify-content: space-between;
       }
       .content{

       }
    
}
</style>
